
import org.w3c.dom.Node;

import Controller.CreateRequestController;

import server.ClientState;
import server.IProtocolHandler;
import server.Server;
import xml.Message;

	/** Decision Lines protocol Handler, some code get from When2Meet Source Code
	 * 
	 * @author zhaolongli
	 *
	 */

public class DecisionLineprotocolHandler implements IProtocolHandler {

	/** Protocol handler knows the server in question. */
	Server server;

	/** Associate a server object with this handler. */
	public void setServer (Server s) {
		this.server = s;
	}

	public synchronized Message process (ClientState st, Message request) {
		Node child = request.contents.getFirstChild();
		
	    if (child.getLocalName().equals ("createRequest")) {
	    	System.out.println("protocol handler processing createRequest ......");
			return new CreateRequestController(st).process(request);
		} 

		// unknown
		System.err.println("Unable to handle message:" + request);
		return null;
	} 
}